<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="http://www.petercorke.com/RVC/common/toolboxhelp.css">
    <title>M-File Help: icp</title>
  </head>
  <body>
  <table border="0" cellspacing="0" width="100%">
    <tr class="subheader">
      <td class="headertitle">M-File Help: icp</td>
      <td class="subheader-left"><a href="matlab:open icp">View code for icp</a></td>
    </tr>
  </table>
<h1>icp</h1><p><span class="helptopic">Point cloud alignment</span></p><p>
<strong>T</strong> = <span style="color:red">icp</span>(<strong>p1</strong>, <strong>p2</strong>, <strong>options</strong>) is the homogeneous transformation that best
transforms the set of points <strong>p1</strong> to <strong>p2</strong> using the iterative closest point
algorithm.

</p>
<p>
[<strong>T</strong>,<strong>d</strong>] = <span style="color:red">icp</span>(<strong>p1</strong>, <strong>p2</strong>, <strong>options</strong>) as above but also returns the norm of the
error between the transformed point set <strong>p2</strong> and <strong>p1</strong>.

</p>
<h2>Options</h2>
<table class="list">
  <tr><td style="white-space: nowrap;" class="col1">'dplot', D</td> <td>show the points P1 and P2 at each iteration, with a
delay of D [sec].</td></tr>
  <tr><td style="white-space: nowrap;" class="col1"> 'plot'</td> <td>show the points P1 and P2 at each iteration, with a
delay of 0.5 [sec].</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'maxtheta', T</td> <td>limit the change in rotation at each step
to T (default 0.05 rad)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'maxiter', N</td> <td>stop after N iterations (default 100)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'mindelta', T</td> <td>stop when the relative change in error norm is less
than T (default 0.001)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'distthresh', T</td> <td>eliminate correspondences more than T x the median distance
at each iteration.</td></tr>
</table>
<h2>Example</h2>
<p>
Create a 3D point cloud

</p>
<pre style="width: 90%%;" class="examples">
p1&nbsp;=&nbsp;randn(3,20);
</pre>
<p>
Transform it by an arbitrary amount

</p>
<pre style="width: 90%%;" class="examples">
T&nbsp;=&nbsp;transl(1,2,3)*eul2tr(0.1,&nbsp;0.2,&nbsp;0.3)
p2&nbsp;=&nbsp;homtrans(&nbsp;T,&nbsp;p1);
</pre>
<p>
Perform <span style="color:red">icp</span> to determine the transformation that maps p1 to p2

</p>
<pre style="width: 90%%;" class="examples">
icp(p1,&nbsp;p2)
</pre>
<h2>Notes</h2>
<ul>
  <li>Does not require knowledge of correspondence between the points.</li>
<ul>
  <li>The point sets may have different numbers of points.</li>
  <li>Points in either set may have no corresponding point.</li>
</ul>
  <li>Points can be 2- or 3-dimensional.</li>
  <li>For noisy data setting distthresh and maxtheta can help to prevent the
solution from diverging.</li>
</ul>
<h2>Reference</h2>
<ul>
  <li>"A method for registration of 3D shapes",
P.Besl and H.McKay,
IEEETrans. Pattern Anal. Mach. Intell., vol. 14, no. 2,
pp. 239-256, Feb. 1992.</li>
</ul>
<hr>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr class="subheader" valign="top"><td>&nbsp;</td></tr></table>
<p class="copy">&copy; 1990-2012 Peter Corke.</p>
</body></html>